import Vue from 'vue'
import Router from 'vue-router'

const _import = (file) => () => {
  return import('@/views/' + file + '.vue')
}

// 组件
const layout = _import('layout/index')
const articleList = _import('article/list')
const articlePublish = _import('article/publish')

const routes = [
  {
    path: '/article',
    component: layout,
    name: '/article',
    redirect: 'list',
    children: [
      {
        path: 'list',
        name: 'list',
        component: articleList
      },
      {
        path: 'publish',
        name: 'publish',
        component: articlePublish
      }
    ]
  }
]

Vue.use(Router)

const router = new Router({
  routes: routes
})

/* router.beforeEach(() => {
}) */

/* router.afterEach(() => {
}) */

export default router
